package com.xdxc.controller;

import com.xdxc.model.dto.ScoringResult;
import com.xdxc.model.form.ScoringRequest;
import com.xdxc.service.impl.AIScoringService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/scoring")
@Validated
public class ScoringController {

    @Autowired
    private AIScoringService scoringService;

    @PostMapping("/auto")
    public ResponseEntity<ScoringResult> scoreV2(
            @Valid @RequestBody ScoringRequest request) {

        return ResponseEntity.ok(scoringService.scoreAnswerWithReason(request));
    }
}
